Skip to content

Expand subclasses for all type triples in indirect TripleStore retrieval - #655

Merged
Demirrr merged 1 commit into
developfrom
fix/triplestore-subclass-closure
Oct 23, 2026
Merged

Demirrr merged 1 commit into
developfrom
fix/triplestore-subclass-closure

Conversation

@Demirrr

@Demirrr Demirrr commented Oct 23, 2026

Copy link
Copy Markdown
Member

Refs #571 (leaving it open for the other suggestions: materialisation / entailment-aware SPARQL).

instances(ce, direct=False) only expanded rdfs:subClassOf* for the root variable (?x a), so fillers such as ?s_1 a :Grandparent in Grandfather ⊓ ∃hasChild.Grandparent missed individuals typed only by a subclass.

  • New with_subclass_closure helper expands every ?var a <Class> triple, each with its own variable (keeps the Issue with indirect instance retrieval on TripleStore #575 scoping fix); skips owl:NamedIndividual.
  • instances, instances_count and is_subset_of_individuals all use it; the latter two previously shared one ?some_cls across scopes.
  • Tests: filler expansion, NamedIndividual skip, count/subset scoping, and a semantic check running the rewritten query with rdflib on a tiny graph. They fail on the old behaviour.

Cost: each filler adds a subClassOf* path join, so indirect queries on deeply nested expressions can be slower on large stores. direct=True is unchanged.

Tested locally with the mocked triplestore tests only (no live Fuseki); the triplestore CI job is the first real-Fuseki run.

🤖 Generated with Claude Code

…val (#571)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Demirrr
Demirrr merged commit e32b842 into develop Oct 23, 2026
4 checks passed
@Demirrr
Demirrr deleted the fix/triplestore-subclass-closure branch October 23, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant